//导入vue核心包
import Vue from 'vue';
//导入App.vue根组件对象
import App from './App.vue';
//集成vue -router功能
import vueRouter from 'vue-router';
//将路由绑定到Vue对象上
Vue.use(vueRouter);
//导入路由规则对应的组件
import home from './components/home.vue';
import newslist from './components/news/newslist.vue';
import newsinfo from './components/news/newsinfo.vue';
// 定义路由规则
var router = new vueRouter({
  linkActiveClass: 'mui-active',
  routes: [{
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      component: home
    },
    {
      path: '/news/newslist',
      component: newslist
    },
    {
      path: '/news/newsinfo/:id',
      component: newsinfo
    }
  ]

});
//导入mint-ui
import mintui from 'mint-ui';
//导入mint-ui的css
import 'mint-ui/lib/style.min.css';
//绑定mintui到Vue对象
Vue.use(mintui);
//导入mui
import '../statics/mui/css/mui.css';
import '../statics/css/site.css';
//导入并绑定vue-resource以使用ajax请求数据
import vueResource from 'vue-resource';
Vue.use(vueResource);
//定义全局过滤器,格式化时间对象
import moment from 'moment';
Vue.filter('datefmt', function (input, fmtstring) {
  return moment(input).format(fmtstring);
});
//导入图片预览组件
import vuePreview from 'vue-preview';
Vue.use(vuePreview);
//new一个Vue对象以解析渲染页面
new Vue({
  el: '#app',
  router,
  render: c => c(App)
})
